<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="dto.companyFormDTO"%>
<%@page import="vo.companyFormVO"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script src = '../js/form.js'></script>
</head>
<body>
<% request.setCharacterEncoding("UTF-8"); %>
<jsp:useBean id="cvo" class="vo.companyFormVO" scope="page"/>
<jsp:setProperty property="*" name="cvo"/>
<%
	int save_type = Integer.parseInt(request.getParameter("save_type"));
%>
<form name="frm" method="post">

	<input type='hidden' name="form_number"  value="<%=cvo.getForm_number()%>" />
	
	<input type='hidden' name="m_id"  value="<%=cvo.getM_id()%>" />
	
	<input type='hidden' name="c_form_number"  value="<%=cvo.getC_form_number()%>" />

	<input type='hidden' name="c_draft_date" value="<%=cvo.getC_draft_date()%>" />
	
	<input type='hidden' name=c_form_type value="<%=cvo.getC_form_type()%>"/>
	
	<input type='hidden' name="e_name" value="<%=cvo.getE_name()%>"/>
	<input type='hidden' name="e_number" value="<%=cvo.getE_number()%>"/>
	<input type='hidden' name="e_position" value="<%=cvo.getE_position()%>"/>
	<input type='hidden' name="d_tname" value="<%=cvo.getD_tname()%>"/>
	
	<input type='hidden' name="c_draft_approbator_1" value="<%=cvo.getC_draft_approbator_1()%>"/>
	<input type='hidden' name="c_draft_approbator_2" value="<%=cvo.getC_draft_approbator_2()%>"/>
	<input type='hidden' name="c_draft_approbator_3" value="<%=cvo.getC_draft_approbator_3()%>"/>
	<input type='hidden' name="c_draft_approbator_4" value="<%=cvo.getC_draft_approbator_4()%>"/>
	<input type='hidden' name="c_draft_approbator_5" value="<%=cvo.getC_draft_approbator_5()%>"/>
	
	<input type="hidden"  name="c_draft_start_date" value="<%=cvo.getC_draft_start_date()%>">
	<input type="hidden"  name="c_draft_end_date"  value="<%=cvo.getC_draft_end_date()%>">
	<input type="hidden" name="c_draft_title" value="<%=cvo.getC_draft_title() %>" />
	<input type="hidden" name="c_draft_context" value="<%=cvo.getC_draft_context()%>"/>
								
</form>
<%
	companyFormDTO cfdto = new companyFormDTO(cvo);
	if(save_type == 1){
		System.out.print("등록창");
		if(cfdto.save_form()){
	%>
		<script type="text/javascript">done();</script> 
	<%}else{%>
		<script type="text/javascript">rollback();</script> 
	<%}%>
<%} else if(save_type == 2){ 
	System.out.print("수정 요청 창");
	if(cfdto.submit_up()){
		%>
			<script type="text/javascript">done();</script> 
		<%}else{%>
			<script type="text/javascript">rollback();</script> 
		<%}%>
<%} else if(save_type == 3){  
	System.out.print("수정 요청 창");
	if(cfdto.submit_down()){
		%>
			<script type="text/javascript">done();</script> 
		<%}else{%>
			<script type="text/javascript">rollback();</script> 
		<%}%>
<%} else if(save_type == 4){  
	System.out.print("수정 창");
	if(cfdto.modify_form()){
		%>
			<script type="text/javascript">done();</script> 
		<%}else{%>
			<script type="text/javascript">rollback();</script> 
		<%}%>
<%} %>
</body>
</html>